home *** CD-ROM | disk | FTP | other *** search
- property iCurrIndexFileName, iCurrentPointList, iCurrentItem, iLimitsList, iMasterIndex, iMaxItems, iSizeIndex
- global gModeState, gAlphaState, gLocalStepCount, gGlobalStepCount, gFirstYearK, gLastYearK, gFTsearchscope, gNumofHits, gStatusField, gNopeSND, gCurrentEntryName
-
- on birth me
- set iSizeIndex to [:]
- sort(iSizeIndex)
- addProp(iSizeIndex, #ENCY, value(field "ENCY_ScrollPoints"))
- addProp(iSizeIndex, #FoundSet, 1)
- if not objectp(iSizeIndex) then
- end if
- set iCurrentItem to 1
- set iLimitsList to [:]
- sort(iLimitsList)
- addProp(iLimitsList, #ENCY, mComputeModesLastEntryNum(me, #ENCY))
- addProp(iLimitsList, #FoundSet, 0)
- mInitMasterIndex(me)
- mUpdateIndexParams(me)
- return me
- end
-
- on mGetSingleModeSize me, pWhat
- set Llist to value(field ("ATTRIB_A_" & string(pWhat)))
- return count(Llist)
- end
-
- on mInitMasterIndex me
- set iMasterIndex to [:]
- sort(iMasterIndex)
- addProp(iMasterIndex, #FoundSet, [0])
- addProp(iMasterIndex, #ENCY, [0])
- set iMaxItems to [#FoundSet: 1, #Resources: 1, #TOPICS: 1, #EPISSUB: 5, #ENCY: 26, #EPIS: 26, #CHRO: gLastYearK]
- mClearThisModesIndex(me, #FoundSet)
- mClearThisModesIndex(me, #ENCY)
- end
-
- on mClearThisModesIndex me, pMode
- set Lmax to getProp(iMaxItems, pMode)
- repeat with i = 1 to Lmax
- setAt(mGetEntireMode(me, pMode), i, 0)
- end repeat
- end
-
- on mClearModesIndex me
- mClearThisModesIndex(me, gModeState)
- end
-
- on mGetThisEntryName me, pMode, pItem, pLocalItem
- return getPropAt(mGetModesAttribGroup(me, pMode, pItem), value(pLocalItem))
- end
-
- on mGetThisEntrysAttribs me, pMode, pItem, pLocalItem
- set vgroup to mGetModesAttribGroup(me, pMode, pItem)
- if vgroup = 0 then
- abort()
- end if
- return getAt(vgroup, pLocalItem)
- end
-
- on mFindThisNtrysAttribs me, pMode, pItem, pName
- set gCurrentEntryName to pName
- mRequestAnyAttrList(me, pItem, pMode)
- set LmyAttribs to getaProp(mGetModesAttribGroup(me, pMode, pItem), pName)
- if not voidp(LmyAttribs) then
- return LmyAttribs
- else
- hputmsg("TRYING EXTRA SPACE IN NAME")
- set LmyAttribs to getaProp(mGetModesAttribGroup(me, pMode, pItem), pName & " ")
- if not voidp(LmyAttribs) then
- return LmyAttribs
- else
- hputmsg("!mFindThisNtrysAttribs couldnt match" && pName)
- return
- end if
- end if
- end
-
- on mSetSingleList me, pWithThisList
- if not objectp(pWithThisList) then
- return 0
- end if
- set Lsize to count(pWithThisList)
- hReportStatus("Building lookup map for " & Lsize & " entries found containing that word.")
- set iCurrentPointList to [Lsize]
- setAt(mGetEntireMode(me, gModeState), 1, pWithThisList)
- mSetCurrItem(me, 1)
- mPrepCurrentLU(oSLlookup)
- return 1
- end
-
- on mUpdateIndexParams me
- set iCurrentPointList to getaProp(iSizeIndex, gModeState)
- if gModeState = #CHRO then
- mSetCurrItem(me, gFirstYearK)
- else
- mSetCurrItem(me, 1)
- end if
- end
-
- on mUpdateLimitsList me, pMode, pSize
- if pMode = #FoundSet then
- setaProp(iLimitsList, pMode, pSize)
- setaProp(iSizeIndex, pMode, pSize)
- else
- setaProp(iLimitsList, pMode, count(mGrabCurrAttrList(me, pMode)))
- end if
- end
-
- on mSetCurrAttrList me, pThisField, pMode
- if hIsaCastMem(pThisField) then
- set LthisItem to hExtractAlphaItem(pThisField)
- if not objectp(mGetModesAttribGroup(me, pMode, LthisItem)) then
- hReportStatus("Loading new index...")
- setAt(mGetEntireMode(me, pMode), LthisItem, value(field pThisField))
- hSetAlphaState(hConvertItemtoAlpha(LthisItem))
- end if
- else
- hReportStatus("Sorry, having trouble decoding that entry name.")
- hearit(gNopeSND)
- abort()
- end if
- if not objectp(iMasterIndex) then
- hputmsg("!>mSetCurrAttrList couldn't create item" & LthisItem & "of iMasterIndex from field >" & pThisField & "<")
- return 0
- end if
- set iCurrentPointList to getaProp(iSizeIndex, pMode)
- mSetCurrItem(me, LthisItem)
- mGetIndexData(oIndexScroller)
- return 1
- end
-
- on mGrabCurrItem me
- return iCurrentItem
- end
-
- on mGetEntireMode me, pMode
- return getaProp(iMasterIndex, pMode)
- end
-
- on mDumpMasterIndex me, pMode
- if pMode = #ALL then
- return iMasterIndex
- else
- return getaProp(iMasterIndex, pMode)
- end if
- end
-
- on mGetModesAttribGroup me, pMode, pItem
- if (pItem > 26) or (pItem < 1) then
- abort()
- end if
- if (pMode = #FoundSet) or (pMode = #TOPICS) then
- set pItem to 1
- end if
- set Lgroup to getAt(mGetEntireMode(me, pMode), value(pItem))
- if not objectp(Lgroup) then
- mLoadAnyAttrList(me, pItem, pMode)
- return getAt(mGetEntireMode(me, pMode), value(pItem))
- else
- return Lgroup
- end if
- end
-
- on mGrabCurrAttrList me, pMode
- return mGetModesAttribGroup(me, pMode, iCurrentItem)
- end
-
- on mRequestAnyAttrList me, pWhatItemNum, pMode
- if not objectp(mGetModesAttribGroup(me, pMode, pWhatItemNum)) then
- mLoadAnyAttrList(me, pWhatItemNum, pMode)
- end if
- end
-
- on mLoadAnyAttrList me, pWhatItemNum, pMode
- put "Loading more index data..." into field "Status"
- set Lthisfield to hConstructFieldName(pWhatItemNum, pMode)
- if hIsaCastMem(Lthisfield) then
- setAt(mGetEntireMode(me, pMode), pWhatItemNum, value(field Lthisfield))
- else
- if Lthisfield = "ATTRIB_R_CHRO" then
- set Lthisfield to "ATTRIB_18_CHRO"
- setAt(mGetEntireMode(me, pMode), pWhatItemNum, value(field Lthisfield))
- exit
- end if
- hearit(gNopeSND)
- return
- end if
- end
-
- on mSetCurrItem me, pWhat
- if gModeState = #FoundSet then
- set pWhat to 1
- end if
- if (pWhat < 1) or (pWhat > getProp(iMaxItems, gModeState)) then
- abort()
- end if
- set iCurrentItem to pWhat
- hSetAlphaState(hConvertItemtoAlpha(value(pWhat)))
- end
-
- on mIsWithinCurrentList me, pWhatCount
- return hGetMyAlphaGroupItem(pWhatCount) / (iCurrentItem * 1.0)
- end
-
- on mGetItemsFirstEntryNum me, pWhatItem
- if pWhatItem = 1 then
- return 1
- end if
- set Lvalue to getAt(iCurrentPointList, pWhatItem - 1) + 1
- return Lvalue
- end
-
- on mGetMyLastEntryNum me, pWhatAlpha
- if gModeState = #FoundSet then
- set Litem to 1
- else
- set Litem to hConvertAlphaToItem(pWhatAlpha)
- end if
- set Lmyvalue to getAt(iCurrentPointList, Litem)
- return Lmyvalue
- end
-
- on mGetPrevLastEntryNum me, pWhatAlpha
- set Lprevitem to hConvertAlphaToItem(hSubtractOnefromMe(pWhatAlpha))
- set Lmyvalue to getAt(iCurrentPointList, Lprevitem)
- return Lmyvalue
- end
-
- on mGetThisItemsMax me, pWhat
- return getAt(iCurrentPointList, pWhat)
- end
-
- on mGetMyFirstGroupLimit me
- return getAt(iCurrentPointList, mGetMyFirstItem(me))
- end
-
- on mGetMyMaxItems me
- return getaProp(iMaxItems, gModeState)
- end
-
- on mGetMyFirstItem me
- if gModeState = #CHRO then
- set Lfirstitem to gFirstYearK
- else
- set Lfirstitem to 1
- end if
- return Lfirstitem
- end
-
- on mGetModesMaxEntryNum me
- return getaProp(iLimitsList, gModeState)
- end
-
- on mGetAnyMaxEntryNum me, pMode
- return getaProp(iLimitsList, pMode)
- end
-
- on mUpdateGlobalFromLocal me
- if iCurrentItem = 1 then
- hSetGlobalCounter(gLocalStepCount)
- else
- hSetGlobalCounter(gLocalStepCount + getAt(iCurrentPointList, iCurrentItem - 1))
- end if
- end
-
- on mConvertGlobaltoLocal me
- if gModeState = #FoundSet then
- set pWhat to 1
- else
- set pWhat to hGetMyAlphaGroupItem(gGlobalStepCount)
- end if
- mSetCurrItem(me, pWhat)
- if iCurrentItem = 1 then
- hSetLocalCounter(gGlobalStepCount)
- else
- hSetLocalCounter(gGlobalStepCount - getAt(iCurrentPointList, iCurrentItem - 1))
- end if
- end
-
- on mTranslateGlobaltoLocal me, pSomeGlobal, pItsItem
- if pItsItem = 1 then
- return pSomeGlobal
- else
- return pSomeGlobal - getAt(iCurrentPointList, pItsItem - 1)
- end if
- end
-
- on mTranslateLocaltoGlobal me, pSomeLocal
- if iCurrentItem = 1 then
- return pSomeLocal
- else
- return pSomeLocal + getAt(iCurrentPointList, iCurrentItem - 1)
- end if
- end
-
- on mComputeModesLastEntryNum me, pMode
- set Lmaxitem to count(getaProp(iSizeIndex, pMode))
- if not voidp(Lmaxitem) then
- set Llist to []
- set Llist to getaProp(iSizeIndex, pMode)
- return getAt(Llist, Lmaxitem)
- else
- end if
- end
-
- on mDumpProps me
- put me
- put "iCurrentPointList=", iCurrentPointList
- put "iCurrentItem=", iCurrentItem
- put "iLimitsList=" & iLimitsList
- put "iMaxItems=" & iMaxItems
- put "size of iSizeIndex=" & count(iSizeIndex)
- end
-
- on mDumpCurrPts me
- put iCurrentPointList
- return iCurrentPointList
- end
-
- on mDumpLimits me
- put iLimitsList
- end
-
- on mUpdateTopicIndex me
- global oIndexScroller
- mClearThisModesIndex(me, #TOPICS)
- setProp(iLimitsList, #TOPICS, mGetSingleModeSize(me, #TOPICS))
- mLoadAnyAttrList(me, 1, #TOPICS)
- end
-